<html dropeffect="none" class="js  is-AppPromotionBarVisible cssanimations csstransforms csstransitions flexbox no-touchevents" style="" lang="zh-CN"><head>
<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta http-equiv="X-ZA-Response-Id" content="000d1b03f3c7b893">
<meta http-equiv="X-ZA-Experiment" content="default:None">

<title>首页 - 知乎</title>
<style>
	*{
		padding:0px;
		margin:0px;
	}
	ul,li{
		list-style: none;
	}
	a{
		border:none;
	}
	a:link{
		color: black;
	}
	a:hover{
		color:#225599;
	}
</style>
<meta name="apple-itunes-app" content="app-id=432274380">


<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="mobile-agent" content="format=html5;url=https://www.zhihu.com/">
<meta id="znonce" name="znonce" content="29530580837446aebb63cd271f2ff040">



<link rel="apple-touch-icon" href="/zhihu/home/images/touch-icon-152.87c020b9.png" sizes="152x152">
<link rel="apple-touch-icon" href="/zhihu/home/images/touch-icon-120.496c913b.png" sizes="120x120">
<link rel="apple-touch-icon" href="/zhihu/home/images/touch-icon-76.dcf79352.png" sizes="76x76">
<link rel="apple-touch-icon" href="/zhihu/home/images/touch-icon-60.9911cffb.png" sizes="60x60">


<link rel="shortcut icon" href="/zhihu/home/images/favicon.ico" type="image/x-icon">

<link rel="search" type="application/opensearchdescription+xml" href="./xml/search.xml" title="知乎">
<link rel="stylesheet" href="/zhihu/home/Css/z.09d0fc1b.css">
<link href="/zhihu/home/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="/zhihu/home/dist/js/jquery-1.11.1.min.js"></script>
<script src="/zhihu/home/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/zhihu/UTF/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/zhihu/UTF/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/zhihu/UTF/lang/zh-cn/zh-cn.js"></script>




<!--[if lt IE 9]>
<script src="https://static.zhihu.com/static/components/respond/dest/respond.min.js"></script>
<link href="https://static.zhihu.com/static/components/respond/cross-domain/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<link href="/static/components/respond/cross-domain/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<script src="/static/components/respond/cross-domain/respond.proxy.js"></script>
<![endif]-->
<script src="/zhihu/home/Scripts/instant.14757a4a.js"></script>

<style>
.zm-item-answer-author-info a.collapse {margin-top: 0}
</style>

</head>

<body class="zhi ">



<div role="navigation" class="zu-top" data-za-module="TopNavBar">
<div class="zg-wrap modal-shifting clearfix" id="zh-top-inner">
<a href="/" class="zu-top-link-logo" id="zh-top-link-logo" data-za-c="view_home" data-za-a="visit_home" data-za-l="top_navigation_zhihu_logo">知乎</a>

<div class="top-nav-profile">
<a href="/people/sun-jian-jian-93" class="zu-top-nav-userinfo ">
<span class="name">孙建建</span>
<img class="Avatar" src="/zhihu/home/images/da8e974dc_s.jpg" srcset="/zhihu/home/images/da8e974dc_xs.jpg 2x" alt="孙建建">
<span id="zh-top-nav-new-pm" class="zg-noti-number zu-top-nav-pm-count" style="visibility:hidden" data-count="0">

</span>
</a>
<ul class="top-nav-dropdown" id="top-nav-profile-dropdown">
<li>
<a href="/people/sun-jian-jian-93">
<i class="zg-icon zg-icon-dd-home"></i>我的主页
</a>
</li>

<li>
<a href="/inbox">
<i class="zg-icon zg-icon-dd-pm"></i>私信
<span id="zh-top-nav-pm-count" class="zu-top-nav-pm-count zg-noti-number" style="visibility:hidden" data-count="0">

</span>
</a>
</li>
<li>
<a href="/settings">
<i class="zg-icon zg-icon-dd-settings"></i>设置
</a>
</li>
<li>
<a href="/logout">
<i class="zg-icon zg-icon-dd-logout"></i>退出
</a>
</li>
</ul>

</div>



<button class="zu-top-add-question" id="zu-top-add-question">提问</button>


<div role="search" id="zh-top-search" class="zu-top-search">
<form method="GET" action="/search" id="zh-top-search-form" class="zu-top-search-form">



<input name="type" value="content" type="hidden">
<label for="q" class="hide-text">知乎搜索</label><input class="zu-top-search-input" id="q" name="q" autocomplete="off" value="" placeholder="搜索你感兴趣的内容..." type="text">
<button type="submit" class="zu-top-search-button"><span class="hide-text">搜索</span><span class="sprite-global-icon-magnifier-dark"></span></button>
</form>
</div>



<div id="zg-top-nav" class="zu-top-nav">
<ul class="zu-top-nav-ul zg-clear">

<li class="zu-top-nav-li current" id="zh-top-nav-home">
<a class="zu-top-nav-link" href="/" id="zh-top-link-home" data-za-c="view_home" data-za-a="visit_home" data-za-l="top_navigation_home">首页</a>
</li>



<li class="top-nav-topic-selector zu-top-nav-li " id="zh-top-nav-topic">
<a class="zu-top-nav-link" href="/topic" id="top-nav-dd-topic">话题</a>
</li>

<li class="zu-top-nav-li " id="zh-top-nav-explore">
<a class="zu-top-nav-link" href="/explore">发现</a>
</li>

<li class="top-nav-noti zu-top-nav-li ">
<a class="zu-top-nav-link" href="javascript:;" id="zh-top-nav-count-wrap" role="button"><span class="mobi-arrow"></span>消息</a>
</li>



</ul>
<div class="zu-top-nav-live zu-noti7-popup zg-r5px no-hovercard" id="zh-top-nav-live-new" role="popup" tabindex="0">
<div class="zu-top-nav-live-inner zg-r5px">
<div class="zu-top-live-icon">&nbsp;</div>
<div class="zu-home-noti-inner" id="zh-top-nav-live-new-inner">
<div class="zm-noti7-popup-tab-container clearfix" tabindex="0">
<button class="zm-noti7-popup-tab-item message">
<span class="icon">消息</span>
</button>
<button class="zm-noti7-popup-tab-item user">
<span class="icon">用户</span>
</button>
<button class="zm-noti7-popup-tab-item thanks">
<span class="icon">赞同和感谢</span>
</button>
</div>
</div>
<div class="zm-noti7-frame-border top"></div>
<div class="zm-noti7-frame">
<div class="zm-noti7-content message">
<div class="zm-noti7-content-inner">
<div class="zm-noti7-content-body">
<div class="zm-noti7-popup-loading">
<span class="noti-spinner-loading"></span>
</div>
</div>
</div>
</div>
<div class="zm-noti7-content user" style="display:none;">
<div class="zm-noti7-content-inner">
<div class="zm-noti7-content-body">
<div class="zm-noti7-popup-loading">
<span class="noti-spinner-loading"></span>
</div>
</div>
</div>
</div>
<div class="zm-noti7-content thanks" style="display:none;">
<div class="zm-noti7-content-inner">
<div class="zm-noti7-content-body">
<div class="zm-noti7-popup-loading">
<span class="noti-spinner-loading"></span>
</div>
</div>
</div>
</div>
</div>
<div class="zm-noti7-frame-border bottom"></div>
<div class="zm-noti7-popup-footer">
<a href="/notifications" class="zm-noti7-popup-footer-all zg-right">查看全部 »</a>
<a href="/settings/notification" class="zm-noti7-popup-footer-set" title="通知设置"><i class="zg-icon zg-icon-settings"></i></a>
</div>
</div>
</div>

</div>

</div>
</div>


<div class="zu-global-notify" id="zh-global-message" style="display:none">
<div class="zg-wrap">
<div class="zu-global-nitify-inner">
<a class="zu-global-notify-close" href="javascript:;" title="关闭" name="close">x</a>
<span class="zu-global-notify-icon"></span>
<span class="zu-global-notify-msg"></span>
</div>
</div>
</div>






<div class="zg-wrap zu-main clearfix " role="main">
<div class="zu-main-content">
<div class="zu-main-content-inner">




<div class="HomeEntry">
<div class="HomeEntry-avatar">
<img class="Avatar Avatar--xs" src="https://pic1.zhimg.com/da8e974dc_xs.jpg" srcset="https://pic1.zhimg.com/da8e974dc_l.jpg 2x" alt="孙建建">
</div>
<div class="HomeEntry-box">
<span class="HomeEntry-boxArrow"></span>
<ul class="HomeEntry-list">
<li class="HomeEntry-item">
<a href="#" class="HomeEntry-ask js-HomeEntry-ask" data-toggle="modal" data-target="#myModal">
<i class="sprite-home-question-off" ></i>
提问
</a>
</li>


<li class="HomeEntry-item">
<a href="/question" target="_blank" class="HomeEntry-answer">
<i class="sprite-home-answer-off"></i>
回答
</a>
</li>
</ul>
</div>
</div>

<div class="zg-section" id="zh-home-list-title">
<i class="zg-icon zg-icon-feedlist"></i>
最新动态 <input id="is-topstory" type="hidden">
<span class="zg-right zm-noti-cleaner-setting" style="list-style:none"></span>
</div>
<div class="zu-main-feed-con" data-feedtype="topstory" id="zh-question-list" data-widget="navigable" data-navigable-options="{&quot;items&quot;:&quot;&gt; .zh-general-list .feed-content&quot;,&quot;offsetTop&quot;:-82}">
<a href="javascript:;" class="zu-main-feed-fresh-button" id="zh-main-feed-fresh-button" style="display:none"></a>
<div id="js-home-feed-list" class="zh-general-list topstory clearfix" data-init="{&quot;params&quot;: {}, &quot;nodename&quot;: &quot;TopStory2FeedList&quot;}">

</div>

<div style = "position:absolute;top:-150px;left:200px;width:530px;" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div style = "background-color:#0D6CCA;height:35px;line-height:35px;font-weight:bold;color:#fff;font-size:14px;">&nbsp;&nbsp;&nbsp;&nbsp;提问
        <button type="button" style = "position:absolute;top:10px;left:500px;" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        &nbsp;&nbsp;&nbsp;&nbsp;
      </div>
      <div class="modal-body">
        <form action="" method="post">	
            <input style = "height:60px;" class="form-control" id="inputEmail3" placeholder="输入你的问题" type="text" name = "question_name">
            问题说明(可选):
            <script id="editor" name = "question_content" type="text/plain" style="width:490px;height:100px;"></script><br />
            选择话题:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style = 'color:#AAAAAA'>话题越精准，越容易让相关领域专业人士看到你的问题</span>
         	 <input style = "height:30px;" class="form-control" id="inputEmail3" placeholder="搜索话题" type="text" name = "topic_id">
      </div>
      <div class="modal-footer">
      		<button type="subbit" class="btn btn-primary">发布</button>
      </div>
      </form>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

@foreach($arr1 as $k=>$v)
<div style = "width:635px;border-bottom:1px solid #CCCCCC;position:relative">

	

	<div style = "float:left">
		<div class = "my_info">
			<img src = "{{$user_portrait[$v]}}" style = "width:35px;"/>
				
			<div style = "width:400px;background-color:#fff;border:1px solid grey;position:absolute;left:-100px;top:35px;z-index:2;display:none" class = "info_div">
		<img src = "{{$user_portrait[$v]}}" style = "width:45px;margin:15px 0 0 15px"/>&nbsp;&nbsp;&nbsp;<span style = "font-weight:bold;color:#225599">{{$whoname[$v]}}</span><br />
		<span style = "margin-left:73px">{{$introduction[$v]}}</span><br /><br />
		<span style = "margin-left:73px;color:grey">{{$professional[$v]}}</span>
		<p style = "background-color:#cccccc;height:80px;margin-bottom:0px;">
			<span style = "border-right:1px solid grey;margin-left:40px;margin-top:10px;padding-right:30px;display:inline-block"><a href = "{{url('/people/answers',[$who_id[$v]])}}"><span style = "font-weight:bold">&nbsp;{{$answernum[$v]}}</span><br/><br/>回答</a></span>
			<span style = "border-right:1px solid grey;margin-left:30px;margin-top:10px;padding-right:30px;display:inline-block"><a href = "{{url('/people/followers',[$who_id[$v]])}}"><span style = "font-weight:bold;padding-left:15px;">{{$focusnum[$v]}}</span><br/><br/>关注者</a></span>
			<span><button type="button" class="btn btn-success follow_him" style = "margin-left:50px;margin-bottom:40px;"><?php echo empty(DB::table("peoplefocus")->where("user_id",$user_id)->where("other_id",$who_id[$v])->first())?"关注他":"取消关注" ?></button><input type = "hidden" value = "{{$who_id[$v]}}" /></span></p></div>


		</div>
		<div class = "apraise"  style = "width:35px;color:#698ebf;border-radius:5px;height:40px;line-height:25px;background-color:#EFF6FA;margin-top:5px;text-align:center;padding-top:5px;">
			<div style = "border:7px solid transparent;margin-left:10px;height:0px;width:0px;border-bottom:5px solid #225599"></div>
			<span>{{$arr[$v]}}</span>
			<input type = "hidden" name = "answer_id" value = {{$v}} />
		</div>
		<div class = "disapraise" style = "width:35px;border-radius:5px;height:25px;background-color:#EFF6FA;margin-top:5px;padding-top:10px;">
			<div style = "border:7px solid transparent;margin-left:10px;height:0px;width:0px;border-top:5px solid #225599"></div>
		</div>
	</div>
	<div style = "float:left;width:585px;margin-left:10px;margin-bottom:10px">
		<span style = "color:#cccccc">热门回答&nbsp;,来自{{implode(",",($arr2[$k]))}}&nbsp;&nbsp;</span>
		<span style = "color:#225599;font-size:10px;">关注话题</span><br />
		<span style = "font-size:15px;color:#225599;font-weight:bold"><?php echo \DB::table("question")->where("id",$k)->first()->question_name ?></span><br />
		<span style = "font-weight:bold">{{$whoname[$v]}}</span>&nbsp;,
		<span style = "color:#cccccc">{{$professional[$v]}}</span><br />
		<div class = "box"><?php echo \DB::table("answer")->where("id",$v)->first()->answer_content ?></div>
		<div style="color:#cccccc"><input type = "hidden" name = "question_id" value = "{{$k}}"/>@if(empty($favor[$v]))<span class = "favor">+&nbsp;关注问题</span>@else <span class = "favor">取消关注</span>  @endif<span class = "comment" style = "margin-left:20px;" class = "comment">{{$commentnum[$v]}}评论</span><input type = "hidden" name = "answer_id" value = "{{$v}}"/></div>
		<ul style = "border:1px solid grey;width:400px;display:none;">
		@foreach($commentcontent[$v] as $kc=>$vc)
			<li style = "padding-left:10px;padding-right:10px;padding-top:10px;" >
				<div style = "display:inline;position:relative" class = "my_info"><span class = "new"><img src = "<?php echo \DB::table("detail")->where('user_id',$vc->user_id)->first()->user_portrait ?>" /></span>
				
				
						
				<div style = "width:400px;background-color:#fff;border:1px solid grey;position:absolute;left:-100px;top:20px;z-index:2;display:none" class = "info_div">
		<img src = "<?php echo \DB::table("detail")->where('user_id',$vc->user_id)->first()->user_portrait ?>" style = "width:45px;margin:15px 0 0 15px"/>&nbsp;&nbsp;&nbsp;<span style = "font-weight:bold;color:#225599"><?php echo \DB::table("user")->where('id',$vc->user_id)->first()->username ?></span><br />
		<span style = "margin-left:73px"><?php echo \DB::table("detail")->where('user_id',$vc->user_id)->first()->introduction ?></span><br /><br />
		<span style = "margin-left:73px;color:grey"><?php echo \DB::table("detail")->where('user_id',$vc->user_id)->first()->professional ?></span>
		<p style = "background-color:#cccccc;height:80px;margin-bottom:0px;">
			<span style = "border-right:1px solid grey;margin-left:40px;margin-top:10px;padding-right:30px;display:inline-block"><a href = "{{url('/people/answers',[$vc->user_id])}}"><span style = "font-weight:bold">&nbsp;{{$answer_num[$v][$kc]}}</span><br/><br/>回答</a></span>
			<span style = "border-right:1px solid grey;margin-left:30px;margin-top:10px;padding-right:30px;display:inline-block"><a href = "{{url('/people/followers',[$vc->user_id])}}"><span style = "font-weight:bold;padding-left:15px;">{{$focus_num[$v][$kc]}}</span><br/><br/>关注者</a></span>
			<span><button type="button" class="btn btn-success follow_him" style = "margin-left:50px;margin-bottom:40px;"><?php echo empty(DB::table("peoplefocus")->where("user_id",$user_id)->where("other_id",$vc->user_id)->first())?"关注他":"取消关注" ?></button><input type = "hidden" value = "{{$vc->user_id}}" /></span></p></div>





				</div>
				<span class = "new" style = "color:#225599"><?php echo \DB::table("user")->where('id',$vc->user_id)->first()->username ?></span><br />
				<input class = "cpraiseId" type = "hidden" name = "cprise_id" value = {{$vc->id}} />
				<span class = "new" style = "margin-left:26px;">{{$vc->comments_content}}</span><br />
				<span style = "margin-left:26px;color:#cccccc">回复</span>&nbsp;&nbsp;@if($cpraise_status[$v][$kc])<span class = "cpraise" style = "color:#cccccc">取消赞</span>@else<span class = "glyphicon glyphicon-thumbs-up cpraise" style = "color:#cccccc">赞</span>@endif
				<span style = "margin-left:230px;color:#cccccc">{{$cprise[$v][$kc]}}个赞</span>
			</li>
		@endforeach
			<form method = "get" >
				<input class="form-control" placeholder="再此输入您的评论" name="comments_content" />
				<!-- 此处user_id为用户id value为session('id')值-->
				<input type = "hidden" id = "user_id" name = "user_id" value = "{{$user_id}}" />
				<input type = "hidden" name = "answer_id" value = "{{$v}}" />
				<button style = "margin-left:330px;" type="submit" class="btn btn-primary">评论</button>
			</form>
		</ul>
	</div>
	<div style = "clear:both"></div>
</div>
@endforeach
</div></div></div></div>
<script type="text/javascript" src = "/zhihu/home/Scripts/jquery-1.8.3.min.js"></script>
<script>
	var obj = document.getElementsByClassName("apraise");
	//这里以后换成session()
	var user_id = document.getElementById("user_id").value;
	//点赞状态变量
	var status;
	//新增加的评论数
	var new_comment_num = 0;
	//当前登录用户的一些信息
	var comment_value_all_all = [];
	for(var i = 0 ;i<obj.length;i++)
	{
		obj[i].onmouseover = function()
		{
			this.style.backgroundColor = "#818EC8";
			this.style.color = "#fff";
			//console.log(this.previousElementSibling);
			this.firstElementChild.style.borderColor = "transparent transparent #fff";
			this.style.cursor = "pointer";
		}
		obj[i].onmouseout = function()
		{
			this.style.backgroundColor = "#EFF6FA";
			this.style.color = "#698ebf";
			this.firstElementChild.style.borderColor = "transparent transparent #225599";
		}
		obj[i].onclick = function()
		{
      			var answer_id = this.lastElementChild.value;
	 			
					var obj = new XMLHttpRequest();
					obj.onreadystatechange = function(){
					if(obj.readyState ==4 && obj.status == 200){
						ress = obj.responseText;

					}
				}
				//发送ajax请求同时传递用户id(谁点赞)和回答的id
				obj.open('GET','/apraise?user_id='+user_id+'&answer_id='+answer_id,false);
				obj.send();
				//alert(ress);
				if(ress == 1)
				{
					this.children[1].textContent = parseInt(this.children[1].textContent)+1;
					status = 1;
					this.onmouseout = function(){
					 	this.style.backgroundColor = "#818EC8";
						this.style.color = "#fff";
					this.firstElementChild.style.borderColor = "transparent transparent #fff";

					}
					
				}
				else{
						this.children[1].textContent = parseInt(this.children[1].textContent)-1;
						if(this.children[1].textContent<=0)
						{
							this.children[1].textContent = 0;
						}
						status = 0;
						this.onmouseout = function(){
						 	this.style.backgroundColor = "#EFF6FA";
							this.style.color = "#698ebf";
							this.firstElementChild.style.borderColor = "transparent transparent #225599";
					}
				}
		}
				

	}

	var obj = document.getElementsByClassName("disapraise");
	for(var i = 0 ;i<obj.length;i++)
	{
		obj[i].onmouseover = function()
		{
			this.style.backgroundColor = "#818EC8";
			this.style.color = "#fff";
			this.firstElementChild.style.borderColor = "#fff transparent transparent";
			this.style.cursor = "pointer";
		}
		obj[i].onmouseout = function()
		{
			this.style.backgroundColor = "#EFF6FA";
			this.firstElementChild.style.borderColor = "#225599 transparent transparent";
			this.style.color = "#698ebf";
		}

		obj[i].onclick = function()
		{
			
	      			var answer_id = this.previousElementSibling.lastElementChild.value;
	               
		 			
							var obj = new XMLHttpRequest();
							obj.onreadystatechange = function(){
							if(obj.readyState ==4 && obj.status == 200){
								resss = obj.responseText;
							}
						}
						//发送ajax请求同时传递用户id(谁点赞)和回答的id
						obj.open('GET','/apraise?user_id='+user_id+'&answer_id='+answer_id+"&flag=reduce",false);
						obj.send();
						if(resss == 0&&status == 1)
						{
							this.previousElementSibling.children[1].textContent = parseInt(this.previousElementSibling.children[1].textContent)-1;
							if(this.previousElementSibling.children[1].textContent<=0)
							{
								this.previousElementSibling.children[1].textContent=0
							}
							status = 0;
							this.onmouseout = function()
								{
									this.previousElementSibling.style.backgroundColor = "#EFF6FA";
									this.previousElementSibling.firstElementChild.style.borderColor = "transparent transparent #225599";
									this.previousElementSibling.style.color = "#698ebf";

									
								}
						}
					
				
		}
	}

	//鼠标放上展示个人信息
	var my_info = document.getElementsByClassName("my_info");
	for(var i = 0;i<my_info.length;i++)
		{
		my_info[i].onmouseover = function(){

			this.lastElementChild.style.display = "block";
		}
		my_info[i].onmouseout = function(){

			this.lastElementChild.style.display = "none";
		}
	}


	//关注问题
	var favor = document.getElementsByClassName("favor");
	for(var i = 0;i<favor.length;i++)
	{
		favor[i].onmouseover = function()
		{
			this.style.color = "#225599";
			this.style.cursor = "pointer";
		}
		favor[i].onmouseout = function()
		{
			this.style.color = "#cccccc";
		}
		

		favor[i].onclick = function()
		{
				var answer_id = this.parentElement.lastElementChild.value;
				var question_id = this.parentElement.firstElementChild.value;
				var obj = new XMLHttpRequest();
				obj.onreadystatechange = function(){
				if(obj.readyState ==4 && obj.status == 200){
					sc = obj.responseText;
				}
			}
			obj.open('GET','/favor?user_id='+user_id+'&question_id='+question_id,false);
			obj.send();
			this.textContent = sc;
		
		}
	}
	//评论
	var comment = document.getElementsByClassName("comment");
	for(var i = 0;i<comment.length;i++)
	{
		comment[i].onmouseover = function(){
			this.style.color = "#225599";
			this.style.cursor = "pointer";
		}
		comment[i].onmouseout = function(){
			this.style.color = "#cccccc";
		}
		comment[i].onclick = function(){
			if(this.textContent!=="收起评论")
			{
				comment_num = this.textContent;
			}
			//alert(comment_num);
			if(this.parentElement.nextElementSibling.style.display == "none")
			{
				this.parentElement.nextElementSibling.style.display = "block";
				this.textContent = "收起评论";
			//当表单提交时,触发表单提交事件
				var form_obj = this.parentElement.nextElementSibling.lastElementChild;
				form_obj.onsubmit = function()
				{
					var comments_content = form_obj.comments_content.value;
					var user_id = form_obj.user_id.value;
				var answer_id = form_obj.answer_id.value;
				var obj = new XMLHttpRequest();
							obj.onreadystatechange = function(){
							if(obj.readyState ==4 && obj.status == 200){
								comment_value_all = obj.responseText;
								eval(' comment_value_all_all = '+comment_value_all);
								comment_value = comment_value_all_all[0];
								//console.log(comment_value_all_all);
							}
						}
						obj.open('GET','/comments?user_id='+user_id+'&answer_id='+answer_id+"&comments_content="+comments_content,false);
						obj.send();
						if(comment_value)
						{
							var newli = this.previousElementSibling.cloneNode(true);
							this.parentElement.insertBefore(newli,this);
							newli.getElementsByClassName("new")[2].textContent = this.firstElementChild.value;
							this.firstElementChild.value = "";
							newli.getElementsByClassName("new")[0].firstElementChild.src = comment_value_all_all[2];
							newli.getElementsByClassName("new")[1].textContent = comment_value_all_all[1];
							
							new_comment_num++;
							comment_value = 0;
						}
						return false;
				
				}
			}
			else
			{
				this.parentElement.nextElementSibling.style.display = "none";
				this.textContent = new_comment_num+parseInt(comment_num)+"评论";
				new_comment_num = 0;
			}
		}
		
		
		
	}
	//关注他
	var follow_him = document.getElementsByClassName("follow_him");
	for(var j = 0;j<follow_him.length;j++)
	{
		follow_him[j].onclick = function(){
				var him_id = this.nextElementSibling.value;
				var obj = new XMLHttpRequest();
				obj.onreadystatechange = function(){
						if(obj.readyState ==4 && obj.status == 200){
							follow_him_value = obj.responseText;
							}
						}
						obj.open('GET','/follow_him?user_id= '+user_id+'&other_id='+him_id,false);
						obj.send();
						if(follow_him_value == 1)
						{
							this.textContent = "取消关注";
							this.parentElement.previousElementSibling.firstElementChild.firstElementChild.textContent = parseInt(this.parentElement.previousElementSibling.firstElementChild.firstElementChild.textContent)+1;
						}
						if(follow_him_value == 0)
						{
							
							this.textContent = "关注他";
							this.parentElement.previousElementSibling.firstElementChild.firstElementChild.textContent = parseInt(this.parentElement.previousElementSibling.firstElementChild.firstElementChild.textContent)-1;
							if(parseInt(this.parentElement.previousElementSibling.firstElementChild.firstElementChild.textContent)<=0)
							{
								this.parentElement.previousElementSibling.firstElementChild.firstElementChild.textContent = 0;
							}
						}

		}
	}
	//评论点赞
	var cpraise = document.getElementsByClassName("cpraise");
	for(var i = 0;i<cpraise.length;i++)
	{
		cpraise[i].onmouseover = function()
		{
			this.style.color = "#225599";
			this.style.cursor = "pointer";
		}
		cpraise[i].onmouseout = function(){
			this.style.color = "#cccccc";
		}
		//点击评论中的赞
		cpraise[i].onclick = function(){
		    var cpraise_id = this.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.value;
			var cpraise_obj = new XMLHttpRequest();
			cpraise_obj.onreadystatechange = function(){
				if(cpraise_obj.readyState ==4 && cpraise_obj.status == 200){
					cpraise_jg = cpraise_obj.responseText;
				}
			}
			cpraise_obj.open('GET','/cpraise?user_id='+user_id+"&replay_id="+cpraise_id,false);
			cpraise_obj.send();
			if(cpraise_jg == 1)
			{
				this.removeAttribute("class","glyphicon glyphicon-thumbs-up");
				//this.setAttribute("class","glyphicon-thumbs-down");
				this.textContent = "取消赞";
				cpraise_jg = 0;
				this.nextElementSibling.textContent =parseInt(this.nextElementSibling.textContent)+1+"个赞";
				//console.log(this.nextElementSibling);
			}
			else
			{
				this.setAttribute("class","glyphicon glyphicon-thumbs-up");
				this.textContent = "赞";
				cpraise_jg = 1;
				this.nextElementSibling.textContent =parseInt(this.nextElementSibling.textContent)-1+"个赞";
				if(parseInt(this.nextElementSibling.textContent)<=0)
				{
					this.nextElementSibling.textContent = "0个赞";
				}
			}
		}
	}

	//点击展开全部或收起部分
	function show(){
	    var box = document.getElementsByClassName("box");
	    var text = [];
	    var btn = [];
	    var newBox = [];
	    var index = [];
		    for(var j = 0;j<box.length;j++)
		    {
				    text[j] = box[j].innerHTML;
				    //alert(text[0]);
				    newBox[j] = document.createElement("div");
				    btn[j] = document.createElement("a");
				    newBox[j].innerHTML = text[j].substring(0,263);
				    btn[j].innerHTML = text[j].length > 263 ? "...显示全部" : "";
				    btn[j].href = "###";
				    btn[j].index = j;
				    btn[j].onmouseover = function()
				    {
				    	this.backgroundColor = "red";
				    }
				    btn[j].onclick = function()
				    {
				    	
					    if (this.innerHTML == "...显示全部")
					    {
						    this.innerHTML = "收起";
						   	this.previousSibling.innerHTML = text[this.index];
						    //$(".box:eq(this.index) div").append(btn[this.index]);
					    }
					    else
					    {
						    this.innerHTML = "...显示全部";
						   this.previousSibling.innerHTML = text[this.index].substring(0,263);
						    //$(".box:eq(this.index) div").append(btn[this.index]);
					    }
				    }
				    box[j].innerHTML = "";
				    box[j].appendChild(newBox[j]);
				    //alert(j);
				    //$(".box:eq(1) div").append(btn[1]);
				    box[j].appendChild(btn[j]);
			}
		}
    show();
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor',{toolbars: [
    ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', '|', 'forecolor', 'backcolor','simpleupload','insertimage','emotion','fontsize', 'fontfamily',]
]});


</script>
</body></html>